#ifndef __UTIL_H__
#define __UTIL_H__
#include <time.h> 



static int curYearMonthStr(std::string& str)
{
	char now[16] = { 0 };
	time_t tt = ::time(NULL);
	struct tm* ttime;
	ttime = ::localtime(&tt);
	::strftime(now, sizeof(now), "%Y%m", ttime);
	str = now;

	return 0;
}

static int curYearMonthStr(const time_t tt, std::string& str)
{
	char now[16] = { 0 };
	struct tm* ttime;
	ttime = ::localtime(&tt);
	::strftime(now, sizeof(now), "%Y%m", ttime);
	str = now;

	return 0;
}

static int tableName(const unsigned int uid, const unsigned int mod, const time_t tt, std::string& name)
{
	char now[56] = { 0 };
	struct tm* ttime;
	ttime = ::gmtime(&tt);
	::snprintf(now, sizeof(now), "flow_%u%02u%02u_%u", (ttime->tm_year + 1900), (ttime->tm_mon + 1), ttime->tm_mday, (uid % mod));

	name = now;
	return 0;
}
#endif